package com.study.spring.bean;

import com.study.spring.model.Member;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.validation.BindException;
import org.springframework.validation.DataBinder;
import org.springframework.web.bind.WebDataBinder;

import java.util.Map;

/**
 * [【小家Spring】聊聊Spring中的数据绑定 \-\-\- DataBinder本尊（源码分析） \- 掘金](https://juejin.im/post/5d312f08e51d45775746b9ea)
 */
public class mvc参数绑定 {
    public static void main(String[] args) throws BindException {
        // DataBinder  WebDataBinder
        Member member = new Member();
        DataBinder dataBinder = new DataBinder(member);
        MutablePropertyValues propertyValues  = new MutablePropertyValues();
        propertyValues.addPropertyValue("memberId","12345");
        propertyValues.addPropertyValue("age",10);
        dataBinder.bind(propertyValues);
     //   Map<?, ?> close = dataBinder.close();
        System.out.println(member.toString());
     //   System.out.println(close);

        WebDataBinder webDataBinder = new WebDataBinder(member);

    }
}
